import { PORT1 } from "@/api/config/servicePort";
import http from "@/api";
import { ReqPage, ResPage } from "../interface";
/**
 * 查询全部部门
 */
export const simpleList = () => {
  return http.get<Dept.ResDept[]>(PORT1 + `/system/sys-dept/simple-list`);
};
/**
 * @name 分页查询角色
 */
export const getDeptList = (params: Dept.ReqDept) => {
  return http.get<ResPage<Dept.ResDept>>(PORT1 + `/system/sys-dept/page`, params);
};
export const saveDept = (params: Dept.ReqDept) => {
  return http.post<ResPage<Dept.ResDept>>(PORT1 + `/system/sys-dept/save`, params);
};
export const editDept = (params: Dept.ReqDept) => {
  return http.post<ResPage<Dept.ResDept>>(PORT1 + `/system/sys-dept/update`, params);
};

export namespace Dept {
  export interface ResDept {
    id: number;
    headUserId: number;
    sort: number;
    deptName: string;
    createBy: number;
    createTime: Date;
    updateBy: number;
    updateTime: Date;
    isDeleted: number;
  }
  export interface ReqDept extends ReqPage {
    id: number;
    deptName: string;
    createBy: number;
    createTime: Date;
    updateBy: number;
    updateTime: Date;
    isDeleted: number;
    headUserId: number;
    sort: number;
  }
}
